/*
 * Copyright (C) 2011, EADS France
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 */
package xowl.interpreter.backends.rdf;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Laurent WOUTERS
 */
public class RDFRule {
    private String iri;
    private List<RDFTriple> antePosAxioms;
    private List<List<RDFTriple>> anteNegAxioms;
    private List<RDFTriple> antePosMeta;
    private List<List<RDFTriple>> anteNegMeta;
    private List<RDFTriple> consPosAxioms;
    private List<List<RDFTriple>> consNegAxioms;
    private List<RDFTriple> consPosMeta;
    private List<List<RDFTriple>> consNegMeta;
    private List<xowl.lang.owl2.LiteralExpression> guards;
    private List<XOWLVariableNode> anteVars;
    private List<XOWLVariableNode> consVars;
    
    public String getIRI() { return iri; }
    public boolean isAntecedentVar(XOWLVariableNode node) { return anteVars.contains(node); }
    public boolean isConsequentVar(XOWLVariableNode node) { return consVars.contains(node); }
    
    public List<RDFTriple> getPositiveAntecedentAxioms() { return antePosAxioms; }
    public List<List<RDFTriple>> getNegativeAntecedentAxioms() { return anteNegAxioms; }
    public List<RDFTriple> getPositiveConsequentAxioms() { return consPosAxioms; }
    public List<List<RDFTriple>> getNegativeConsequentAxioms() { return consNegAxioms; }
    public List<RDFTriple> getPositiveAntecedentMeta() { return antePosMeta; }
    public List<List<RDFTriple>> getNegativeAntecedentMeta() { return anteNegMeta; }
    public List<RDFTriple> getPositiveConsequentMeta() { return consPosMeta; }
    public List<List<RDFTriple>> getNegativeConsequentMeta() { return consNegMeta; }
    public List<xowl.lang.owl2.LiteralExpression> getGuards() { return guards; }
    
    public RDFRule(String iri) {
        this.iri = iri;
        this.antePosAxioms = new ArrayList<RDFTriple>();
        this.anteNegAxioms = new ArrayList<List<RDFTriple>>();
        this.antePosMeta = new ArrayList<RDFTriple>();
        this.anteNegMeta = new ArrayList<List<RDFTriple>>();
        this.consPosAxioms = new ArrayList<RDFTriple>();
        this.consNegAxioms = new ArrayList<List<RDFTriple>>();
        this.consPosMeta = new ArrayList<RDFTriple>();
        this.consNegMeta = new ArrayList<List<RDFTriple>>();
        this.guards = new ArrayList<xowl.lang.owl2.LiteralExpression>();
        this.anteVars = new ArrayList<XOWLVariableNode>();
        this.consVars = new ArrayList<XOWLVariableNode>();
    }
    
    public void addAntecedentVar(XOWLVariableNode node) {
        if (!anteVars.contains(node))
            anteVars.add(node);
    }
    public void addConsequentVar(XOWLVariableNode node) {
        if (!anteVars.contains(node) || consVars.contains(node))
            consVars.add(node);
    }
}
